package com.itheima.app.config;

public class R1<T> {
    private boolean flag;
    private String message;
    private T data;

    public static <T> R1<T> success(T data) {
        R1<T> r = new R1<>();
        r.flag = true;
        r.message = "OK";
        r.data = data;
        return r;
    }

    // TODO 自行添加其他操作成功或失败的静态方法

    /**
     * 失败
     */
    public static <T> R1<T> error(String message) {
        R1<T> r = new R1<>();
        r.flag = false;
        r.message = message;
        return r;
    }

    /**
     * 成功
     */
    public static <T> R1<T> success() {
        R1<T> r = new R1<>();
        r.flag = true;
        r.message = "OK";
        return r;
    }
}